package cn.com.taiji.oospub.wechat.service.impl;

import cn.com.taiji.oospub.wechat.entity.Restaurant;
import cn.com.taiji.oospub.wechat.mapper.RestaurantMapper;
import cn.com.taiji.oospub.wechat.service.IRestaurantService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 餐厅 服务实现类
 * </p>
 *
 * @author yzd
 * @since 2020-12-14
 */
@Service
public class RestaurantServiceImpl extends ServiceImpl<RestaurantMapper, Restaurant> implements IRestaurantService {
    @Autowired
    private RestaurantMapper restaurantMapper;

    @Override
    public Restaurant findByProperty(String columnName, String value) {
        Map<String,Object> columnMap=new HashMap<>();
        columnMap.put(columnName, value);
        List<Restaurant> schoolBaseInfos = restaurantMapper.selectByMap(columnMap);
        if (schoolBaseInfos.size()>0){
            return schoolBaseInfos.get(0);
        }
        return null;
    }
}
